package me.linczh.bank.action;

import java.util.List;

import me.linczh.bank.bean.EmployeeBean;
import me.linczh.bank.bean.LogBean;
import me.linczh.bank.service.LogService;
import me.linczh.framework.action.ActionExecutor;

public class LogAction extends ActionExecutor {
	private String datetype;
	private String date;
	private String month;
	private String quarter;
	private String year;
	private String querytype;
	private String employee;
	private String department;
	
	private List<LogBean> logs;

	public String query() {
		LogService logger = new LogService();
		logs = logger.showlog();
		return "success";
	}
	
	public String report() {
		LogService logger = new LogService();
		try {
			int datenum = Integer.parseInt(datetype);
			int quarternum = Integer.parseInt(quarter);
			int querynum = 0;
			if (querytype != null) querynum = Integer.parseInt(querytype);
			if (employee == null) employee = ((EmployeeBean)super.session.getAttribute("user")).getEmployee();
			if (department == null) department = ((EmployeeBean)super.session.getAttribute("user")).getDepartment().toString();
			logs = logger.logReport(datenum, date, month, quarternum, year, querynum, employee, department);
		} catch (NumberFormatException e) {
			
		}
		return "success";
	}

	public List<LogBean> getLogs() {
		return logs;
	}

	public void setLogs(List<LogBean> logs) {
		this.logs = logs;
	}

	public String getDatetype() {
		return datetype;
	}

	public void setDatetype(String datetype) {
		this.datetype = datetype;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getMonth() {
		return month;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public String getQuarter() {
		return quarter;
	}

	public void setQuarter(String quarter) {
		this.quarter = quarter;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getQuerytype() {
		return querytype;
	}

	public void setQuerytype(String querytype) {
		this.querytype = querytype;
	}

	public String getEmployee() {
		return employee;
	}

	public void setEmployee(String employee) {
		this.employee = employee;
	}

	public String getDepartment() {
		return department;
	}

	public void setDepartment(String department) {
		this.department = department;
	}
	
}
